<?php

namespace app\common\model\Post;

use think\Model;

/**
 * @mixin \think\Model
 */
class Collect extends Model
{
    // 指定数据表
    protected $name = 'post_collect';

    // 开启自动写入时间戳
    protected $autoWriteTimestamp = true;

    // 写入到表当中哪个字段
    protected $createTime = 'createtime';  
    
    // 关闭自动写入
    protected $updateTime = false;
    protected $deleteTime = false;

    // 忽略数据表不存在的字段
    protected $field = true;

    public function business()
    {
        return  $this->belongsTo('app\common\model\Business\Business', 'busid', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function post()
    {
        return  $this->belongsTo('app\common\model\Post\Post', 'postid', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
